{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecfb2954",
   "metadata": {},
   "outputs": [],
   "source": [
    "library(tidyverse)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c5aa3a71",
   "metadata": {},
   "outputs": [],
   "source": [
    "options(repr.plot.width=10, repr.plot.height=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a2b6fa31",
   "metadata": {},
   "outputs": [],
   "source": [
    "d <- data.frame(\n",
    "    x          = c(   2,    4,    6,    8,   10,   20,   50,  100),\n",
    "    finetuned  = c(3.91, 3.81, 3.77, 3.81, 3.68, 3.47, 3.41, 3.38),\n",
    "    supervised = c(9.34, 7.55, 6.70, 6.20, 5.53, 5.00, 4.50, 4.30),\n",
    "    frozen     = c(5.09, 4.90, 4.82, 4.85, 4.71, 4.76, 4.59, 4.55)\n",
    ")\n",
    "\n",
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9e134e64",
   "metadata": {},
   "outputs": [],
   "source": [
    "d %>% ggplot(aes(x=x, group=1)) +\n",
    "        geom_line(aes(y=finetuned, color=\"Self-supervised (fine-tuned)\"), linewidth=1) +\n",
    "        geom_line(aes(y=frozen, color=\"Self-supervised (frozen)\"), linewidth=1) +\n",
    "        geom_line(aes(y=supervised, color=\"Supervised\"), linewidth=1) +\n",
    "\n",
    "        geom_point(aes(y=finetuned, color=\"Self-supervised (fine-tuned)\"), size=3) +\n",
    "        geom_point(aes(y=frozen, color=\"Self-supervised (frozen)\"), size=3) +\n",
    "        geom_point(aes(y=supervised, color=\"Supervised\"), size=3) +\n",
    "        \n",
    "        scale_colour_manual(values=c(\"#eb4034\", \"#2b4fa1\", \"#01041a\")) +\n",
    "\n",
    "        xlab(\"Percentage of labeled data\") +\n",
    "        ylab(\"EER(%)\") +\n",
    "        theme_bw() +\n",
    "        theme(text = element_text(size=24)) +\n",
    "        \n",
    "        theme(\n",
    "            legend.title=element_blank(),\n",
    "            legend.position = c(0.98, 0.98),\n",
    "            legend.justification = c(\"right\", \"top\"),\n",
    "            legend.box.just = \"right\",\n",
    "            legend.margin = margin(0, 10, 10, 10),\n",
    "            legend.background = element_rect(color='#ededed', fill='white', linetype='solid')\n",
    "        ) +\n",
    "        scale_x_continuous(breaks=x, trans='log10')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "55e2c2ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "ggsave(filename = \"label_efficient.pdf\", width=10, height=5, device=cairo_pdf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "13428aba",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "4.2.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
